<?php

# 论坛信息
include_once(_CONST_LOCAL_INCLUDE_PATH."session.class.php");

// handle session input
$sessionhash = $_COOKIE[_CONST_COOKIE_PREFIX.'sessionhash'];

$session = new Session(
  $database,
  $_COOKIE[_CONST_COOKIE_PREFIX.'sessionhash'],
  $_COOKIE[_CONST_COOKIE_PREFIX.'userid'],
  $_COOKIE[_CONST_COOKIE_PREFIX.'password']);
$userinfo =& $session->fetch_userinfo();
$user =& $userinfo;
$session->do_lastvisit_update($_COOKIE[_CONST_COOKIE_PREFIX.'lastvisit'], $_COOKIE[_CONST_COOKIE_PREFIX.'lastactivity']);

$is_moderator = 0;
if (preg_match("/,11,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_moderator = 1;
}
if (preg_match("/,7,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_moderator = 1;
}
if (preg_match("/,5,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_moderator = 1;
}

$is_contributor = 0;
if (preg_match("/,9,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_contributor = 1;
}

$is_administrator = 0;
if (preg_match("/,6,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_administrator = 1;
}

$is_adult = 0;
if ($is_administrator || preg_match("/,10,/", ",".$user['usergroupid'].",".$user['membergroupids'].",")) {
	$is_adult = 1;
}

?>